<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <link href="layui/css/layui.css" rel="stylesheet">
</head>
<body>
<blockquote class="layui-elem-quote layui-text">
  进销管理
</blockquote>
<div class="layui-card layui-panel">
  <div class="layui-card-header">
    销售退货
  </div>
  <div class="layui-card-body">
    <form  action="findSalesReturn.re" method="post">
               <span>
               <input type="text" placeholder="销售单号" name="salesnumber"  style="width: 120px;height: 28px" >
               <button class="layui-btn" type="submit">查找</button></span>
              <button type="button" class="layui-btn layui-btn-primary" lay-on="page">添加</button>
    </form>
      <table class="layui-hide" id="ID-table-demo-data" lay-filter="test"></table>
  </div>
</div>
</body>
<script src="layui/layui.js"></script>
<script src="js/jquery-3.7.0.js"></script>
<script type="text/html" id="bar">
    <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script>
    layui.use(function(){
        var $ = layui.$;
        var form = layui.form;
        var layer = layui.layer;
        var util = layui.util;
        util.on('lay-on', {
            page: function(){
                // 页面层
                layer.open({
                    type: 1,
                    btn:['确定','取消'],
                    area: ['420px', '240px'], // 宽高
                    content: '<div style="padding: 11px;"><form action="addSalesReturn.re" method="post">\n' +
                        '        销售单号:<input type="text" name="salesnumber" placeholder="销售单号" value=""/><br/>\n' +
                        '        退销数量:<input type="text" name="goods_returned_count" placeholder="退销数量" value=""/><br/>\n' +
                        '        退销单价:<input type="text" name="goods_returned_price" placeholder="退销单价" value=""/><br/>\n' +
                        // '        退购总价:<input type="text" name="goods_returned_total" placeholder="退购总价" value=""/><br/>\n' +
                        '        退销原因:<input type="textarea" name="goods_returned_reason" placeholder="退销原因" value=""/><br/>\n' +
                        '        状态:<select style="width: 100px " id="select" onchange="" name="status">\n' +
                        '                <option value="完成">完成</option>\n' +
                        '                <option value="进行中">进行中</option>\n' +
                        '              </select><br/>\n' +
                        '        <input type="submit" value="确认" style="float: right">\n' +
                        '</form></div>'
                })
            }
        });
        // 提交事件
        form.on('submit(demo-submit)', function(data){
            var field = data.field; // 获取表单全部字段值
            var elem = data.elem; // 获取当前触发事件的元素 DOM 对象，一般为 button 标签
            var elemForm = data.form; // 获取当前表单域的 form 元素对象，若容器为 form 标签才会返回。
            // 显示填写结果，仅作演示用
            layer.alert(JSON.stringify(field), {
                title: '当前填写的字段值'
            });
            // 此处可执行 Ajax 等操作
            // …
            return false; // 阻止默认 form 跳转
        });
    });
    layui.use('table', function(){
        var table = layui.table;
        // 已知数据渲染
        var inst = table.render({
            elem: '#ID-table-demo-data',
            url: 'http://localhost:8080/jxc01/ListSalesReturn.re',
            cols: [[ //标题栏
                {field: 'id', title: 'ID', width: 80, sort: true},
                {field: 'salesnumber', title: '销售单号', minWidth: 140},
                {field: 'goods_returned_num', title: '退货单号', minWidth: 140},
                {field: 'goods_returned_count', title: '退购数量', width: 80},
                {field: 'goods_returned_price', title: '退购单价', width: 100},
                {field: 'goods_returned_total', title: '退购总价', minWidth: 100},
                {field: 'goods_returned_time', title: '退货时间', width: 180, sort: true},
                {field: 'goods_returned_reason', title: '退购原因', width: 150},
                {field: 'condition', title: '状态', width: 120},
                {field: 'status', title: '备注', width: 100},
            ]],
            // data: [{ // 赋值已知数据
            //     "id": "10001",
            //     "username": "张三1",
            //     "sex": "男",
            //     "city": "浙江杭州",
            //     "sign": "人生恰似一场修行",
            //     "experience": "116"
            // }],
            //skin: 'line', // 表格风格
            //even: true,
            page: true, // 是否显示分页
            limits: [5, 10, 15],
            limit: 5 // 每页默认显示的数量
        });
    });

</script>
</html>